<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="css/lib/bootstrap.min.css"/>
        <link rel="stylesheet" href="css/iconfont.css">
        <link rel="stylesheet" href="css/iconfont2.css">
        <script src="js/lib/jquery-1.11.0.js"></script>
        <script src="js/lib/bootstrap.min.js"></script>
        <script src="https://cdn.bootcss.com/angular.js/1.6.3/angular.min.js"></script>
        <script src="js/lib/ecx.js"></script>
        <script src="js/base.js" type="text/javascript" charset="utf-8"></script>
    </head>
     <style>
      body{
                    font-size:12px;
                    /* user-select: none */
                }
      .abc{position:fixed;left:0;top:0;right:0;margin:0px 5px 0px 5px;} 
        /* body{
                    font-size:12px;
                }*/
        table,
            th,
            td {
                border: 1px solid #fff;
                border-collapse: collapse;
                padding: 5px;
                vertical-align: middle !important;
            }       
            table td:nth-child(even) {
                
            }
            table tr:nth-child(2) {
                background-color:#f1f1f1;
            }
            input{
                width:280px;
            }
            span{
                width:20px;color:red;display:inline-block;text-align:center;
            }
            #sho{
                width:300px;
                height:50px;
                background:#d9534f;
                opacity:0.8;
                border-radius:8px;
                color:#fff;
                text-align: center;
                font-size:30px;
                position: absolute;
                top:0px;
                left:550px;
                display:none;
            } 
        #tt a{
            width:150px;
            height:50px;
            display:block;
            background:rgba(0, 122, 255,0.9);
            text-align:center;
            line-height:50px;
            float:left;
            margin-right:30px;
            font-size:20px;
            color:#fff;
        }
     </style>
    <body ng-app="myApp" ng-controller="customersCtrl">
        <div class="">
            <div id="sho"></div>
        <!--更新用户账户信息-->
            <div style="padding:15px 5px 0px 5px;border:1px solid #ccc;margin-bottom:15px;position:relative;">
            <table id="tab" class="table table-hover">
                <tbody id="datatable">
                    <!-- <tr>
                        <td id="tt" colspan="14">
                            <a href="全平台交易信息.html">全部</a>
                            <a href="全平台交易信息-充值.html">充值</a>
                            <a href="全平台交易信息-提现.html">提现</a>
                            <a href="全平台交易信息-待结算.html">待结算</a>
                            <a href="全平台交易信息-支付.html">支付</a>
                        </td>
                    </tr> -->
                    <tr>
                        <td colspan="14">
                            <h4>商户交易记录</h4>
                        </td>
                    </tr>
                    <tr id="tr-2">
                        <td colspan="14">
                        <!--交易时间查询-->
                            <i class="iconfont icon-rili1" style="color:rgba(0, 122, 255,0.9)"></i>  <input id="d1" type="date" ng-model="star" class="form-control" style="width:150px;display:inline-block" placeholder="开始时间"> — <i class="iconfont icon-rili2" style="color:rgba(0, 122, 255,0.9)"></i>
                            <input id="d2" type="date" ng-model="end" class="form-control" style="width:150px;display:inline-block">
                            <i class="iconfont icon-chongzhi" style="color:rgba(0, 122, 255,0.9)"></i>
                            <input class="form-control" style="width:150px;display:inline-block" type="text" name="" id="" ng-model="ph" value="" placeholder="手机号" /><span id="error" style="color:red"></span>
                            <i class="iconfont icon-zhifu" style="color:rgba(0, 122, 255,0.9)"></i>
                            <input class="form-control" v-model="card" placeholder="银行卡信息" style="width:200px;display:inline-block;" type="text">
                            <input class="form-control" style="width:150px;display:inline-block"  type="text" id="dingdan" ng-model="ddan" placeholder="订单号查询">
                             <select name="" id="sel1" v-on:change="xuan()" class="form-control" style="width:100px;display:inline-block">
                                <option value="">类型</option>
                                <option value="0">充值</option>
                                <option value="1">支付</option>
                                <option value="2">提现</option>
                                <option value="3">退单</option>
                            </select>
                             <select name="" id="sel2" v-on:change="xuan()" class="form-control" style="width:100px;display:inline-block">
                                <option value="">状态</option>
                                <option value="0">待完成</option>
                                <option value="1">已成功</option>
                                <option value="2">已取消</option>
                                <option value="3">未提交</option>
                                <option value="4">待结算</option>
                            </select>                           
                            <button class="btn btn-danger btn-sm" ng-click="dd()"><i class="iconfont icon-chaxun01"></i>查询</button>
                        </td>
                    </tr>
                    <tr id="tr" style="font-size:14px;background:rgba(0, 122, 255,0.9);color:#fff;">
                        <td style="width:60px;" class="text-center">序号</td>
                        <td  class="text-center">交易时间</td>
                        <td class="text-center">通道</td>
                        <td  class="text-center">品牌名称</td>
                        <td  class="text-center">刷卡费率</td>
                        <td class="text-center">总金额</td>
                        <td  class="text-center">实际金额</td>
                        <!-- <td style="width:4%" class="text-center">额外费用</td> -->
                        <td class="text-center">手机号</td>
                        <td class="text-center">订单号</td>
                        <td class="text-center">商户订单号</td>
                        <td class="text-center">备注信息</td>
                        <td class="text-center">描述</td>
                        <td class="text-center">类型</td>
                        <td class="text-center">状态</td>             
                    </tr>
                    <tr id="show" ng-repeat="item in items">
                        <td  class="text-center">
                            <input type="checkbox" style="width:20px;">
                        </td>
                        <td  class="text-center">{{item.createTime}}</td>
                        <td  class="text-center">{{item.channelname}}</td>
                        <td  class="text-center">{{item.brandname}}</td>
                        <td  class="text-center">{{item.rate}}</td>
                        <td  class="text-center">{{item.amount | currency:"￥ "}}</td>
                        <td  class="text-center">{{item.realAmount | currency:"￥ "}}</td>
                        <!-- <td class="text-center">{{item.extraFee | currency:"￥ "}}</td>  -->                
                        <td  class="text-center">{{item.phone}}</td>
                        <td class="text-center">{{item.ordercode}}</td>
                        <td class="text-center">{{item.thirdOrdercode}}</td>
                        <td  class="text-center">{{item.remark}}</td>
                        <td  class="text-center">{{item.desc}}</td>
                        <td  class="text-center">{{item.type | modify:item.type}}</td>
                        <td  class="text-center">
                        <img ng-if="item.status==1" style="width:20px;height:20px;" src="images/成功.png" alt="" />
                        <img ng-if="item.status==4" style="width:20px;height:20px;" src="images/待结算金额.png" alt="" />
                        <img ng-if="item.status==0" style="width:20px;height:20px;" src="images/待完成.png" alt="" />
                        <!-- <img ng-if="item.status==1" style="width:20px;height:20px;" src="images/失败.png" alt="" /> -->
                        <img ng-if="item.status==2" style="width:20px;height:20px;" src="images/已取消.png" alt="" />
                        {{item.status | modify2:item.status}}
                        </td>

                    </tr>
                    <tr>
                        <td colspan="14" ng-show="items.length==0" style="font-size:13px;color:#ccc;text-align:center;">---------------------------------------------------------没有查询到数据-------------------------------------------------------------</td>
                    </tr>
                    <tr>
                        <td colspan="14" id="show01" class="text-center">
                            第<input class="form-control" id="ye" ng-init="ye=1" ng-model="ye" style="width:50px;display:inline-block" type="text"/>页
                            <button class="btn btn-default" ng-click="xia()">GO</button>总共{{pages}}条数据    当前一共{{page}}页
                            <button class="btn btn-default" ng-click="home()">首页</button>
                            <button class="btn btn-default" ng-click="sh()">上一页</button>
                            <button class="btn btn-default" ng-click="next()">下一页</button>
                            <button class="btn btn-default" ng-click="last(page)">尾页</button>
                        </td>                       
                    </tr>
                    <tr>
                        <td colspan="14">
                                
<a class="btn btn-default" download="我是被导出的表格.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">下载表格</a>

                        </td>
                    </tr>
                </tbody>
            </table>        
        </div>
        </div>
    </body>
    <script>
        $(function(){
            $("#btt").click(function(){
                $(".table2excel").table2excel({
                    exclude: ".noExl",
                    name: "Excel Document Name",
                    filename: "myFileName",
                    exclude_img: true,
                    exclude_links: true,
                    exclude_inputs: true
                });             
            });
        })
    </script>
    <script>
        var app = angular.module('myApp', []);
         /*自定义过滤器   1*/
        app.filter("modify",function(){
            return function(input,param){
                if(param == 0){
                    return param = "充值"
                }
                if(param == 1){
                    return param = "支付"
                }
                if(param == 2){
                    return param = "提现"
                }
                if(param == 3){
                    return param = "退单"
                }
                if(param == 4){
                    return param = "话费充值"
                }
                input = param
                return input
            }
        })
        /*自定义过滤器   2*/
        app.filter("modify2",function(){
            return function(input,param){
                if(param == 0){
                    return param = "待完成"
                }
                if(param == 1){
                    return param = "已成功"
                }
                if(param == 2){
                    return param = "已取消"
                }
                if(param == 3){
                    return param = "待处理"
                }
                if(param == 4){
                    return param = "待结算"
                }
                input = param
                return input
            }
        });     
        app.controller('customersCtrl', function($scope, $http ){
            /*根据登陆信息获取token*/
            var token = sessionStorage.getItem(key=1);
            var brandid = sessionStorage.getItem(key=3);
            var d1 = document.getElementById('d1').value;//获取开始时间
            var d2 = document.getElementById('d2').value;//获取结束时间
            var data = {
                brand_id:"",
                user_id:"",
                order_status:1,
                order_code:"",
                third_order_code:"",
                channel_no:"",
                page:"",
                size:"",
                order:"",
                sort:""//type 充值类型 status 充值状态 
            };
            /*直接或分页查询交易明细*/

                $http({
                    method:'POST',
                    params:{brand_id:sessionStorage.getItem(key=3),size:15},                
                    url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"        
                }).then(function successCallback(data){
                    console.log("直接或分页查询交易明细成功...")
                    console.log(data.data)
                    $scope.items = data.data.result.content
                    $scope.pages = data.data.result.totalElements
                    $scope.page  = data.data.result.totalPages
                    /*$scope.size = */
                }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                });
                $scope.xia = function(){
                    var brandid = sessionStorage.getItem(key=3);
                    var ye = document.getElementById("ye").value-1;
                    $http({
                    method:'POST',
                    params:{size:15,page:ye,channel_no:3,brand_id:sessionStorage.getItem(key=3)},                   
                    url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"                    
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                            console.log("直接或分页查询交易明细失败...")
                            console.log(data)
                    });
                }
                /*查询*/
                $scope.dd = function(){
                    var d1 = document.getElementById('d1').value;//获取开始时间
                    var d_1 = document.getElementById('d2').value;
                    d_1 = d_1.substr(0,9)
                    console.log(d_1)
                    var d_2 = parseInt(document.getElementById('d2').value.substr(9,10))+1;
                    console.log(d_2)
                    var d2 = d_1+d_2;//获取结束时间
                    console.log(d1,d2);
                    var oSel1=document.getElementById('sel1');
                    var oSel2=document.getElementById('sel2');
                    var sel1 = oSel1.options[oSel1.selectedIndex].value;//获取审核状态参数
                    var sel2 = oSel2.options[oSel2.selectedIndex].value;
                    var brandid = sessionStorage.getItem(key=3);
                    /*var data = {
                        phone:$scope.ph,
                        order_code:$scope.ddan,
                        start_time:d1,
                        end_time:d2,
                        size:500,
                        type:sel1,
                        status:sel2
                    };*/
                    var data = {
                        size:15,brand_id:brandid
                    }
                    console.log(data)
                        $http({
                        method:'POST',
                        params:data,
                        url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                }               
                /*回到首页*/
                $scope.home = function(){
                    var brandid = sessionStorage.getItem(key=3);
                    $scope.ye = 1;
                    $http({
                        method:'POST',
                        params:{size:15,page:$scope.ye-1,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                }
                /*到达最后一页*/
                $scope.last = function(page){
                    var brandid = sessionStorage.getItem(key=3);
                    console.log(page);
                    $http({
                        method:'POST',
                        params:{size:15,page:page-1,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                    $scope.ye = page
                }
                /*下一页*/
                $scope.next = function(){
                    var brandid = sessionStorage.getItem(key=3);
                    var ye =  $scope.ye+=1;
                   console.log(ye-1)
                    $http({
                        method:'POST',
                        params:{size:15,page:ye-1,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                }
                /*上一页*/
                $scope.sh = function(){
                    var brandid = sessionStorage.getItem(key=3);
                    var x = $scope.ye-=1;
                    var ye = x-1;
                    console.log(ye);
                    if(ye <= 0){
                        $scope.ye = 1;
                        console.log(ye)
                    }
                    $http({
                        method:'POST',
                        params:{size:15,page:ye,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/queryPaymentOrder"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                }
                
        })
    </script>
    <script> 
$(function(){
        
        /*模糊条件搜索函数*/
        function MH(){
             $('#mohu').click(function(){            
            var txt = $('#txt').val();
            console.log(txt);
            $('#tab tr:not("#tr,#tr-1,#tr-2,#tr-3")').hide().filter(':contains("'+txt+'")').show();
            })
        }
       /*调用模糊搜索函数*/
       MH();
})
</script>
</html>

